{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\user\\Anaconda3\\lib\\site-packages\\statsmodels\\tools\\_testing.py:19: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.\n",
      "  import pandas.util.testing as tm\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'D:\\\\Hackathon\\\\Machinehack\\\\ODI_Participants_Data'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "import os\n",
    "os.getcwd()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "train=pd.read_csv('Train.csv')\n",
    "test=pd.read_csv('Test.csv')\n",
    "submission=pd.read_excel('Sample_submission.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team1</th>\n",
       "      <th>Team2</th>\n",
       "      <th>Stadium</th>\n",
       "      <th>HostCountry</th>\n",
       "      <th>Team1_Venue</th>\n",
       "      <th>Team2_Venue</th>\n",
       "      <th>Team1_Innings</th>\n",
       "      <th>Team2_Innings</th>\n",
       "      <th>MonthOfMatch</th>\n",
       "      <th>MatchWinner</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>37</td>\n",
       "      <td>4</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>Second</td>\n",
       "      <td>First</td>\n",
       "      <td>Dec</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>14</td>\n",
       "      <td>84</td>\n",
       "      <td>7</td>\n",
       "      <td>Neutral</td>\n",
       "      <td>Neutral</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Sep</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>9</td>\n",
       "      <td>15</td>\n",
       "      <td>47</td>\n",
       "      <td>9</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Feb</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7</td>\n",
       "      <td>2</td>\n",
       "      <td>102</td>\n",
       "      <td>6</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Aug</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>6</td>\n",
       "      <td>8</td>\n",
       "      <td>46</td>\n",
       "      <td>5</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Aug</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Team1  Team2  Stadium  HostCountry Team1_Venue Team2_Venue Team1_Innings  \\\n",
       "0      5      4       37            4        Home        Away        Second   \n",
       "1      1     14       84            7     Neutral     Neutral         First   \n",
       "2      9     15       47            9        Home        Away         First   \n",
       "3      7      2      102            6        Home        Away         First   \n",
       "4      6      8       46            5        Home        Away         First   \n",
       "\n",
       "  Team2_Innings MonthOfMatch  MatchWinner  \n",
       "0         First          Dec            4  \n",
       "1        Second          Sep            1  \n",
       "2        Second          Feb            9  \n",
       "3        Second          Aug            2  \n",
       "4        Second          Aug            6  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2508, 10)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x22d279b5278>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD7CAYAAACRxdTpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAT7UlEQVR4nO3dfbBc9X3f8fcHQQgOxObhggWCiKFyU0gH2bkje+rMhASPUcy4wqndEZlxNB5aeaYwdlp3GpH8YadTpUwmxn+0xY08ECupbarUdlH8FB5i7LjtgAWRASEoMsggSyNdO7axEw+txLd/7GG8vbpXd+/Ze/Xwu+/XzM6e/Z1zvve7e1efPfu7Z1epKiRJbTntRDcgSVp4hrskNchwl6QGGe6S1CDDXZIaZLhLUoNOP9ENAFxwwQW1cuXKE92GJJ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Ur3fp5Kl8Dta8h9iWghJHpttFT3P6lnKNU8FS/V+n0qW+u/IcF8YFwHXMTj1cViA/2nNJi3V+30qWdK/I8N9YXyOwYdPdk5fkeRBazZpqd7vU8mS/h055y5JDTqpP6EqSerHcJekBhnuktQgw12SGmS4S1KD/h8UxVzf1WfdvAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "train.MatchWinner.value_counts().plot.bar()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team1</th>\n",
       "      <th>Team2</th>\n",
       "      <th>Stadium</th>\n",
       "      <th>HostCountry</th>\n",
       "      <th>Team1_Venue</th>\n",
       "      <th>Team2_Venue</th>\n",
       "      <th>Team1_Innings</th>\n",
       "      <th>Team2_Innings</th>\n",
       "      <th>MonthOfMatch</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>34</td>\n",
       "      <td>1</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Oct</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>14</td>\n",
       "      <td>1</td>\n",
       "      <td>19</td>\n",
       "      <td>15</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Mar</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>9</td>\n",
       "      <td>10</td>\n",
       "      <td>130</td>\n",
       "      <td>14</td>\n",
       "      <td>Neutral</td>\n",
       "      <td>Neutral</td>\n",
       "      <td>Second</td>\n",
       "      <td>First</td>\n",
       "      <td>Dec</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>9</td>\n",
       "      <td>10</td>\n",
       "      <td>8</td>\n",
       "      <td>9</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Dec</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>15</td>\n",
       "      <td>130</td>\n",
       "      <td>14</td>\n",
       "      <td>Neutral</td>\n",
       "      <td>Neutral</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Oct</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Team1  Team2  Stadium  HostCountry Team1_Venue Team2_Venue Team1_Innings  \\\n",
       "0      2      4       34            1        Home        Away         First   \n",
       "1     14      1       19           15        Home        Away         First   \n",
       "2      9     10      130           14     Neutral     Neutral        Second   \n",
       "3      9     10        8            9        Home        Away         First   \n",
       "4      5     15      130           14     Neutral     Neutral         First   \n",
       "\n",
       "  Team2_Innings MonthOfMatch  \n",
       "0        Second          Oct  \n",
       "1        Second          Mar  \n",
       "2         First          Dec  \n",
       "3        Second          Dec  \n",
       "4        Second          Oct  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def team_dummy(df):\n",
    "    dum=df[['Team1','Team2']]\n",
    "    dum=dum.astype(str)\n",
    "    dummy=dum.stack().str.get_dummies().sum(level=0)\n",
    "    dummy=dummy.astype(int)\n",
    "    df=pd.concat([df,dummy],1)\n",
    "    df.drop(['Team1','Team2'],1,inplace=True)\n",
    "    return df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "train=team_dummy(train)\n",
    "test=team_dummy(test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3583, 24)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "total=pd.concat([train,test])\n",
    "total.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Stadium</th>\n",
       "      <th>HostCountry</th>\n",
       "      <th>Team1_Venue</th>\n",
       "      <th>Team2_Venue</th>\n",
       "      <th>Team1_Innings</th>\n",
       "      <th>Team2_Innings</th>\n",
       "      <th>MonthOfMatch</th>\n",
       "      <th>MatchWinner</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>...</th>\n",
       "      <th>14</th>\n",
       "      <th>15</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>37</td>\n",
       "      <td>4</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>Second</td>\n",
       "      <td>First</td>\n",
       "      <td>Dec</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>84</td>\n",
       "      <td>7</td>\n",
       "      <td>Neutral</td>\n",
       "      <td>Neutral</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Sep</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>47</td>\n",
       "      <td>9</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Feb</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>102</td>\n",
       "      <td>6</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Aug</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>46</td>\n",
       "      <td>5</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Aug</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 24 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   Stadium  HostCountry Team1_Venue Team2_Venue Team1_Innings Team2_Innings  \\\n",
       "0       37            4        Home        Away        Second         First   \n",
       "1       84            7     Neutral     Neutral         First        Second   \n",
       "2       47            9        Home        Away         First        Second   \n",
       "3      102            6        Home        Away         First        Second   \n",
       "4       46            5        Home        Away         First        Second   \n",
       "\n",
       "  MonthOfMatch  MatchWinner  0  1  ...  14  15  2  3  4  5  6  7  8  9  \n",
       "0          Dec          4.0  0  0  ...   0   0  0  0  1  1  0  0  0  0  \n",
       "1          Sep          1.0  0  1  ...   1   0  0  0  0  0  0  0  0  0  \n",
       "2          Feb          9.0  0  0  ...   0   1  0  0  0  0  0  0  0  1  \n",
       "3          Aug          2.0  0  0  ...   0   0  1  0  0  0  0  1  0  0  \n",
       "4          Aug          6.0  0  0  ...   0   0  0  0  0  0  1  0  1  0  \n",
       "\n",
       "[5 rows x 24 columns]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "total.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Stadium</th>\n",
       "      <th>Team1_Venue</th>\n",
       "      <th>Team2_Venue</th>\n",
       "      <th>Team1_Innings</th>\n",
       "      <th>Team2_Innings</th>\n",
       "      <th>MonthOfMatch</th>\n",
       "      <th>MatchWinner</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>10</th>\n",
       "      <th>...</th>\n",
       "      <th>HostCountry__7</th>\n",
       "      <th>HostCountry__8</th>\n",
       "      <th>HostCountry__9</th>\n",
       "      <th>HostCountry__10</th>\n",
       "      <th>HostCountry__11</th>\n",
       "      <th>HostCountry__12</th>\n",
       "      <th>HostCountry__13</th>\n",
       "      <th>HostCountry__14</th>\n",
       "      <th>HostCountry__15</th>\n",
       "      <th>HostCountry__16</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>37</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>Second</td>\n",
       "      <td>First</td>\n",
       "      <td>Dec</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>84</td>\n",
       "      <td>Neutral</td>\n",
       "      <td>Neutral</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Sep</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>47</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Feb</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>102</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Aug</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>46</td>\n",
       "      <td>Home</td>\n",
       "      <td>Away</td>\n",
       "      <td>First</td>\n",
       "      <td>Second</td>\n",
       "      <td>Aug</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 40 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   Stadium Team1_Venue Team2_Venue Team1_Innings Team2_Innings MonthOfMatch  \\\n",
       "0       37        Home        Away        Second         First          Dec   \n",
       "1       84     Neutral     Neutral         First        Second          Sep   \n",
       "2       47        Home        Away         First        Second          Feb   \n",
       "3      102        Home        Away         First        Second          Aug   \n",
       "4       46        Home        Away         First        Second          Aug   \n",
       "\n",
       "   MatchWinner  0  1  10  ...  HostCountry__7  HostCountry__8  HostCountry__9  \\\n",
       "0          4.0  0  0   0  ...               0               0               0   \n",
       "1          1.0  0  1   0  ...               1               0               0   \n",
       "2          9.0  0  0   0  ...               0               0               1   \n",
       "3          2.0  0  0   0  ...               0               0               0   \n",
       "4          6.0  0  0   0  ...               0               0               0   \n",
       "\n",
       "   HostCountry__10  HostCountry__11  HostCountry__12  HostCountry__13  \\\n",
       "0                0                0                0                0   \n",
       "1                0                0                0                0   \n",
       "2                0                0                0                0   \n",
       "3                0                0                0                0   \n",
       "4                0                0                0                0   \n",
       "\n",
       "   HostCountry__14  HostCountry__15  HostCountry__16  \n",
       "0                0                0                0  \n",
       "1                0                0                0  \n",
       "2                0                0                0  \n",
       "3                0                0                0  \n",
       "4                0                0                0  \n",
       "\n",
       "[5 rows x 40 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dummy=pd.get_dummies(total['HostCountry'],prefix='HostCountry_')\n",
    "total=pd.concat([total,dummy],1)\n",
    "total.drop('HostCountry',1,inplace=True)\n",
    "total.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Team1_Venue',\n",
       " 'Team2_Venue',\n",
       " 'Team1_Innings',\n",
       " 'Team2_Innings',\n",
       " 'MonthOfMatch']"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cat=total.select_dtypes(object).columns.to_list()\n",
    "cat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.preprocessing import LabelEncoder\n",
    "le =LabelEncoder()\n",
    "for items in cat:\n",
    "    total[items]=le.fit_transform(total[items])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Stadium</th>\n",
       "      <th>Team1_Venue</th>\n",
       "      <th>Team2_Venue</th>\n",
       "      <th>Team1_Innings</th>\n",
       "      <th>Team2_Innings</th>\n",
       "      <th>MonthOfMatch</th>\n",
       "      <th>MatchWinner</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>10</th>\n",
       "      <th>...</th>\n",
       "      <th>HostCountry__7</th>\n",
       "      <th>HostCountry__8</th>\n",
       "      <th>HostCountry__9</th>\n",
       "      <th>HostCountry__10</th>\n",
       "      <th>HostCountry__11</th>\n",
       "      <th>HostCountry__12</th>\n",
       "      <th>HostCountry__13</th>\n",
       "      <th>HostCountry__14</th>\n",
       "      <th>HostCountry__15</th>\n",
       "      <th>HostCountry__16</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>37</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>84</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>11</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>47</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>102</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>46</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 40 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   Stadium  Team1_Venue  Team2_Venue  Team1_Innings  Team2_Innings  \\\n",
       "0       37            1            0              1              0   \n",
       "1       84            2            2              0              1   \n",
       "2       47            1            0              0              1   \n",
       "3      102            1            0              0              1   \n",
       "4       46            1            0              0              1   \n",
       "\n",
       "   MonthOfMatch  MatchWinner  0  1  10  ...  HostCountry__7  HostCountry__8  \\\n",
       "0             2          4.0  0  0   0  ...               0               0   \n",
       "1            11          1.0  0  1   0  ...               1               0   \n",
       "2             3          9.0  0  0   0  ...               0               0   \n",
       "3             1          2.0  0  0   0  ...               0               0   \n",
       "4             1          6.0  0  0   0  ...               0               0   \n",
       "\n",
       "   HostCountry__9  HostCountry__10  HostCountry__11  HostCountry__12  \\\n",
       "0               0                0                0                0   \n",
       "1               0                0                0                0   \n",
       "2               1                0                0                0   \n",
       "3               0                0                0                0   \n",
       "4               0                0                0                0   \n",
       "\n",
       "   HostCountry__13  HostCountry__14  HostCountry__15  HostCountry__16  \n",
       "0                0                0                0                0  \n",
       "1                0                0                0                0  \n",
       "2                0                0                0                0  \n",
       "3                0                0                0                0  \n",
       "4                0                0                0                0  \n",
       "\n",
       "[5 rows x 40 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "total.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_final=total[:train.shape[0]]\n",
    "test_final=total[train.shape[0]:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2508, 40)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_final.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1075, 40)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_final.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "X=train_final.drop('MatchWinner',1)\n",
    "y=train.MatchWinner\n",
    "test_final=test_final.drop('MatchWinner',1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.3,random_state=7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0]\tvalidation_0-mlogloss:2.74013\n",
      "Will train until validation_0-mlogloss hasn't improved in 100 rounds.\n",
      "[100]\tvalidation_0-mlogloss:1.41568\n",
      "[200]\tvalidation_0-mlogloss:1.02574\n",
      "[300]\tvalidation_0-mlogloss:0.851673\n",
      "[400]\tvalidation_0-mlogloss:0.763041\n",
      "[500]\tvalidation_0-mlogloss:0.713589\n",
      "[600]\tvalidation_0-mlogloss:0.684331\n",
      "[700]\tvalidation_0-mlogloss:0.665575\n",
      "[800]\tvalidation_0-mlogloss:0.655909\n",
      "[900]\tvalidation_0-mlogloss:0.650354\n",
      "[1000]\tvalidation_0-mlogloss:0.647969\n",
      "[1100]\tvalidation_0-mlogloss:0.64751\n",
      "[1200]\tvalidation_0-mlogloss:0.647675\n",
      "Stopping. Best iteration:\n",
      "[1102]\tvalidation_0-mlogloss:0.647416\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1,\n",
       "              colsample_bynode=1, colsample_bytree=0.8, eval_metric='mlogloss',\n",
       "              gamma=0, learning_rate=0.01, max_delta_step=0, max_depth=1,\n",
       "              min_child_weight=1, missing=None, n_estimators=5000, n_jobs=1,\n",
       "              nthread=None, objective='multi:softprob', random_state=0,\n",
       "              reg_alpha=0, reg_lambda=1, scale_pos_weight=1, seed=100,\n",
       "              silent=None, subsample=1, verbosity=1)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from xgboost import XGBClassifier\n",
    "model_2 = XGBClassifier(\n",
    " learning_rate =0.01,\n",
    " n_estimators=5000,\n",
    " max_depth=1,\n",
    " colsample_bytree=0.8,\n",
    " seed=100,\n",
    " eval_metric='mlogloss'\n",
    " )\n",
    "#model.fit(X_train, y_train)\n",
    "model_2.fit(X_train, y_train, eval_metric='mlogloss', \n",
    "          eval_set=[(X_test, y_test)], early_stopping_rounds=100, verbose=100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1,\n",
       "              colsample_bynode=1, colsample_bytree=0.8, gamma=0,\n",
       "              learning_rate=0.01, max_delta_step=0, max_depth=1,\n",
       "              min_child_weight=1, missing=None, n_estimators=1100, n_jobs=1,\n",
       "              nthread=None, objective='multi:softprob', random_state=0,\n",
       "              reg_alpha=0, reg_lambda=1, scale_pos_weight=1, seed=100,\n",
       "              silent=None, subsample=1, verbosity=1)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model_xgb=XGBClassifier(\n",
    " learning_rate =0.01,\n",
    " n_estimators=1100,\n",
    " max_depth=1,\n",
    " colsample_bytree=0.8,\n",
    " seed=100\n",
    " )\n",
    "model_xgb.fit(X,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import cross_val_score\n",
    "score=cross_val_score(X=X,y=y,estimator=model_xgb,scoring='neg_log_loss',cv=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-0.61470854, -0.6084379 , -0.62946576, -0.64161022, -0.62545583])"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-0.6239356493999123"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.mean(score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_pred=model_xgb.predict_proba(test_final)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "submission=pd.DataFrame(y_pred)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>10</th>\n",
       "      <th>11</th>\n",
       "      <th>12</th>\n",
       "      <th>13</th>\n",
       "      <th>14</th>\n",
       "      <th>15</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.000586</td>\n",
       "      <td>0.001013</td>\n",
       "      <td>0.277486</td>\n",
       "      <td>0.000512</td>\n",
       "      <td>0.708607</td>\n",
       "      <td>0.001200</td>\n",
       "      <td>0.000674</td>\n",
       "      <td>0.001080</td>\n",
       "      <td>0.000556</td>\n",
       "      <td>0.001125</td>\n",
       "      <td>0.001325</td>\n",
       "      <td>0.000519</td>\n",
       "      <td>0.001031</td>\n",
       "      <td>0.001523</td>\n",
       "      <td>0.001491</td>\n",
       "      <td>0.001272</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.000299</td>\n",
       "      <td>0.509556</td>\n",
       "      <td>0.001083</td>\n",
       "      <td>0.000262</td>\n",
       "      <td>0.000509</td>\n",
       "      <td>0.000573</td>\n",
       "      <td>0.000349</td>\n",
       "      <td>0.000551</td>\n",
       "      <td>0.000284</td>\n",
       "      <td>0.000574</td>\n",
       "      <td>0.000513</td>\n",
       "      <td>0.000265</td>\n",
       "      <td>0.000581</td>\n",
       "      <td>0.000718</td>\n",
       "      <td>0.483345</td>\n",
       "      <td>0.000539</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.000508</td>\n",
       "      <td>0.000818</td>\n",
       "      <td>0.000910</td>\n",
       "      <td>0.000589</td>\n",
       "      <td>0.000680</td>\n",
       "      <td>0.000761</td>\n",
       "      <td>0.000727</td>\n",
       "      <td>0.000553</td>\n",
       "      <td>0.000938</td>\n",
       "      <td>0.388481</td>\n",
       "      <td>0.600618</td>\n",
       "      <td>0.000694</td>\n",
       "      <td>0.000871</td>\n",
       "      <td>0.000809</td>\n",
       "      <td>0.001205</td>\n",
       "      <td>0.000838</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.000326</td>\n",
       "      <td>0.000576</td>\n",
       "      <td>0.001180</td>\n",
       "      <td>0.000285</td>\n",
       "      <td>0.000514</td>\n",
       "      <td>0.000601</td>\n",
       "      <td>0.000544</td>\n",
       "      <td>0.000418</td>\n",
       "      <td>0.000309</td>\n",
       "      <td>0.554786</td>\n",
       "      <td>0.437157</td>\n",
       "      <td>0.000533</td>\n",
       "      <td>0.000617</td>\n",
       "      <td>0.000787</td>\n",
       "      <td>0.000911</td>\n",
       "      <td>0.000457</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.000742</td>\n",
       "      <td>0.001164</td>\n",
       "      <td>0.001397</td>\n",
       "      <td>0.000862</td>\n",
       "      <td>0.001051</td>\n",
       "      <td>0.776596</td>\n",
       "      <td>0.000724</td>\n",
       "      <td>0.001157</td>\n",
       "      <td>0.001371</td>\n",
       "      <td>0.001210</td>\n",
       "      <td>0.001502</td>\n",
       "      <td>0.000594</td>\n",
       "      <td>0.001283</td>\n",
       "      <td>0.001082</td>\n",
       "      <td>0.001603</td>\n",
       "      <td>0.207660</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          0         1         2         3         4         5         6  \\\n",
       "0  0.000586  0.001013  0.277486  0.000512  0.708607  0.001200  0.000674   \n",
       "1  0.000299  0.509556  0.001083  0.000262  0.000509  0.000573  0.000349   \n",
       "2  0.000508  0.000818  0.000910  0.000589  0.000680  0.000761  0.000727   \n",
       "3  0.000326  0.000576  0.001180  0.000285  0.000514  0.000601  0.000544   \n",
       "4  0.000742  0.001164  0.001397  0.000862  0.001051  0.776596  0.000724   \n",
       "\n",
       "          7         8         9        10        11        12        13  \\\n",
       "0  0.001080  0.000556  0.001125  0.001325  0.000519  0.001031  0.001523   \n",
       "1  0.000551  0.000284  0.000574  0.000513  0.000265  0.000581  0.000718   \n",
       "2  0.000553  0.000938  0.388481  0.600618  0.000694  0.000871  0.000809   \n",
       "3  0.000418  0.000309  0.554786  0.437157  0.000533  0.000617  0.000787   \n",
       "4  0.001157  0.001371  0.001210  0.001502  0.000594  0.001283  0.001082   \n",
       "\n",
       "         14        15  \n",
       "0  0.001491  0.001272  \n",
       "1  0.483345  0.000539  \n",
       "2  0.001205  0.000838  \n",
       "3  0.000911  0.000457  \n",
       "4  0.001603  0.207660  "
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "submission.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "test=pd.read_csv('Test.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(submission.shape[0]):\n",
    "    team1=test.iloc[i]['Team1']\n",
    "    team2=test.iloc[i]['Team2']\n",
    "    if submission.iloc[i][team1] > submission.iloc[i][team2]:\n",
    "        submission.iloc[i][team1]=1-submission.iloc[i][team2]\n",
    "    else:\n",
    "        submission.iloc[i][team2]=1-submission.iloc[i][team1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>10</th>\n",
       "      <th>11</th>\n",
       "      <th>12</th>\n",
       "      <th>13</th>\n",
       "      <th>14</th>\n",
       "      <th>15</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.000586</td>\n",
       "      <td>0.001013</td>\n",
       "      <td>0.277486</td>\n",
       "      <td>0.000512</td>\n",
       "      <td>0.722514</td>\n",
       "      <td>0.001200</td>\n",
       "      <td>0.000674</td>\n",
       "      <td>0.001080</td>\n",
       "      <td>0.000556</td>\n",
       "      <td>0.001125</td>\n",
       "      <td>0.001325</td>\n",
       "      <td>0.000519</td>\n",
       "      <td>0.001031</td>\n",
       "      <td>0.001523</td>\n",
       "      <td>0.001491</td>\n",
       "      <td>0.001272</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.000299</td>\n",
       "      <td>0.516655</td>\n",
       "      <td>0.001083</td>\n",
       "      <td>0.000262</td>\n",
       "      <td>0.000509</td>\n",
       "      <td>0.000573</td>\n",
       "      <td>0.000349</td>\n",
       "      <td>0.000551</td>\n",
       "      <td>0.000284</td>\n",
       "      <td>0.000574</td>\n",
       "      <td>0.000513</td>\n",
       "      <td>0.000265</td>\n",
       "      <td>0.000581</td>\n",
       "      <td>0.000718</td>\n",
       "      <td>0.483345</td>\n",
       "      <td>0.000539</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.000508</td>\n",
       "      <td>0.000818</td>\n",
       "      <td>0.000910</td>\n",
       "      <td>0.000589</td>\n",
       "      <td>0.000680</td>\n",
       "      <td>0.000761</td>\n",
       "      <td>0.000727</td>\n",
       "      <td>0.000553</td>\n",
       "      <td>0.000938</td>\n",
       "      <td>0.388481</td>\n",
       "      <td>0.611519</td>\n",
       "      <td>0.000694</td>\n",
       "      <td>0.000871</td>\n",
       "      <td>0.000809</td>\n",
       "      <td>0.001205</td>\n",
       "      <td>0.000838</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.000326</td>\n",
       "      <td>0.000576</td>\n",
       "      <td>0.001180</td>\n",
       "      <td>0.000285</td>\n",
       "      <td>0.000514</td>\n",
       "      <td>0.000601</td>\n",
       "      <td>0.000544</td>\n",
       "      <td>0.000418</td>\n",
       "      <td>0.000309</td>\n",
       "      <td>0.562843</td>\n",
       "      <td>0.437157</td>\n",
       "      <td>0.000533</td>\n",
       "      <td>0.000617</td>\n",
       "      <td>0.000787</td>\n",
       "      <td>0.000911</td>\n",
       "      <td>0.000457</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.000742</td>\n",
       "      <td>0.001164</td>\n",
       "      <td>0.001397</td>\n",
       "      <td>0.000862</td>\n",
       "      <td>0.001051</td>\n",
       "      <td>0.792340</td>\n",
       "      <td>0.000724</td>\n",
       "      <td>0.001157</td>\n",
       "      <td>0.001371</td>\n",
       "      <td>0.001210</td>\n",
       "      <td>0.001502</td>\n",
       "      <td>0.000594</td>\n",
       "      <td>0.001283</td>\n",
       "      <td>0.001082</td>\n",
       "      <td>0.001603</td>\n",
       "      <td>0.207660</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          0         1         2         3         4         5         6  \\\n",
       "0  0.000586  0.001013  0.277486  0.000512  0.722514  0.001200  0.000674   \n",
       "1  0.000299  0.516655  0.001083  0.000262  0.000509  0.000573  0.000349   \n",
       "2  0.000508  0.000818  0.000910  0.000589  0.000680  0.000761  0.000727   \n",
       "3  0.000326  0.000576  0.001180  0.000285  0.000514  0.000601  0.000544   \n",
       "4  0.000742  0.001164  0.001397  0.000862  0.001051  0.792340  0.000724   \n",
       "\n",
       "          7         8         9        10        11        12        13  \\\n",
       "0  0.001080  0.000556  0.001125  0.001325  0.000519  0.001031  0.001523   \n",
       "1  0.000551  0.000284  0.000574  0.000513  0.000265  0.000581  0.000718   \n",
       "2  0.000553  0.000938  0.388481  0.611519  0.000694  0.000871  0.000809   \n",
       "3  0.000418  0.000309  0.562843  0.437157  0.000533  0.000617  0.000787   \n",
       "4  0.001157  0.001371  0.001210  0.001502  0.000594  0.001283  0.001082   \n",
       "\n",
       "         14        15  \n",
       "0  0.001491  0.001272  \n",
       "1  0.483345  0.000539  \n",
       "2  0.001205  0.000838  \n",
       "3  0.000911  0.000457  \n",
       "4  0.001603  0.207660  "
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "submission.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "submission[submission<0.05]=0\n",
    "submission[submission>0.95]=1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>10</th>\n",
       "      <th>11</th>\n",
       "      <th>12</th>\n",
       "      <th>13</th>\n",
       "      <th>14</th>\n",
       "      <th>15</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.277486</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.722514</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.00000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.516655</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.483345</td>\n",
       "      <td>0.00000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.388481</td>\n",
       "      <td>0.611519</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.00000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.562843</td>\n",
       "      <td>0.437157</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.00000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.79234</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.20766</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     0         1         2    3         4        5    6    7    8         9  \\\n",
       "0  0.0  0.000000  0.277486  0.0  0.722514  0.00000  0.0  0.0  0.0  0.000000   \n",
       "1  0.0  0.516655  0.000000  0.0  0.000000  0.00000  0.0  0.0  0.0  0.000000   \n",
       "2  0.0  0.000000  0.000000  0.0  0.000000  0.00000  0.0  0.0  0.0  0.388481   \n",
       "3  0.0  0.000000  0.000000  0.0  0.000000  0.00000  0.0  0.0  0.0  0.562843   \n",
       "4  0.0  0.000000  0.000000  0.0  0.000000  0.79234  0.0  0.0  0.0  0.000000   \n",
       "\n",
       "         10   11   12   13        14       15  \n",
       "0  0.000000  0.0  0.0  0.0  0.000000  0.00000  \n",
       "1  0.000000  0.0  0.0  0.0  0.483345  0.00000  \n",
       "2  0.611519  0.0  0.0  0.0  0.000000  0.00000  \n",
       "3  0.437157  0.0  0.0  0.0  0.000000  0.00000  \n",
       "4  0.000000  0.0  0.0  0.0  0.000000  0.20766  "
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "submission.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "submission.to_excel('submission_final.xlsx',index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
